package com.shuoyutech.dp.util;

import com.shuoyutech.dp.common.framework.exception.BusinessException;
import org.springframework.lang.Nullable;

/**
 * 断言
 * @author dyb
 * @date 2020/8/29
 */
public class AssertUtils {
    

    public static void isTrue(boolean expression, String message) {
        if (!expression) {
            throw new BusinessException(message);
        }
    }

    public static void isNull(@Nullable Object obj, String message) {
        if (obj != null) {
            throw new BusinessException(message);
        }
    }

    public static void notNull(@Nullable Object obj, String message) {
        if (obj == null) {
            throw new BusinessException(message);
        }
    }
}
